#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int DigitSum(unsigned int n)
{
	if (n <= 9)
	{
		
		return n;
	}
	else
	{

		return DigitSum(n/10) + n % 10;
	}

}


int main()
{
	int m = 0;
	int k = 0;
	scanf("%d", &m);
	k = DigitSum(m);
	printf("%d", k);
	return 0;
}